<template>

  <div v-if="showflag" class="pages">
    <el-pagination
      background
      :current-page="Number(paginationPage)"
      :total="Number(total)"
      :page-size="Number(paginationPagesize)"
      :page-sizes="[10,20,30, 50]"
      layout=" prev, pager, next,sizes, jumper"
      @size-change="onPageSizeChange"
      @current-change="onPageChange"
    />
  </div>

</template>
<script>
export default {
  name: 'PageTool',
  props: ['total', 'paginationPage', 'paginationPagesize'],
  data() {
    return {
      showflag: true
    }
  },
  methods: {
    // 进入某一页
    onPageChange: function(pageNum) {
      this.$emit('pageChange', pageNum)
    },
    // 每页显示信息条数
    onPageSizeChange: function(pageSize) {
      this.showflag = this.total > pageSize
      if (!this.showflag) {
        this.$emit('pageChange', 1)
      }
      this.$emit('pageSizeChange', pageSize)
    }
  }
}
</script>
<style>
.blue {
    color: #409eff;
}
</style>
